// 账号管理相关API
import { axiosInstance } from './request'

const accountAPI = {
  // 获取账号列表
  getAccounts(params) {
    return axiosInstance({
      url: '/accounts',
      method: 'get',
      params,
    })
  },
  // 获取我的账号
  getMyAccounts(params) {
    return axiosInstance({
      url: '/accounts/my',
      method: 'get',
      params,
    })
  },
  // 获取单个账号详情
  getAccount(id) {
    return axiosInstance({
      url: `/accounts/${id}`,
      method: 'get',
    })
  },
  // 创建账号
  createAccount(data) {
    return axiosInstance({
      url: '/accounts',
      method: 'post',
      data,
    })
  },
  // 更新账号
  updateAccount(id, data) {
    return axiosInstance({
      url: `/accounts/${id}`,
      method: 'put',
      data,
    })
  },
  // 删除账号
  deleteAccount(id) {
    return axiosInstance({
      url: `/accounts/${id}`,
      method: 'delete',
    })
  },
  // 搜索账号
  searchAccounts(params) {
    return axiosInstance({
      url: '/accounts/search',
      method: 'get',
      params,
    })
  },
  // 审核账号
  auditAccount(id, data) {
    return axiosInstance({
      url: `/accounts/${id}/audit`,
      method: 'put',
      data,
    })
  },
  // 下架账号
  delistAccount(id, data = {}) {
    return axiosInstance({
      url: `/accounts/${id}/delist`,
      method: 'put',
      data,
    })
  }
}
// 导出整个 API 对象
export default accountAPI